package com.example.demo.postgres;

import com.alibaba.fastjson.JSON;
import com.example.demo.util.LogUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author zhangxinju@hellobike.com
 * @date 2019-08-23 09:25
 **/
@Service
public class PostgresService implements InitializingBean {

    private final JdbcTemplate jdbcTemplate;

    @Autowired
    public PostgresService(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    private void getData(){
        /*String sql ="select * from t_blue_spot";
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);

        LogUtils.COMMON.info("result : {}", JSON.toJSONString(mapList));*/
    }


    @Override
    public void afterPropertiesSet() throws Exception {
        getData();
    }
}
